<template>
  <div class="login-dialog">
    <div class="login-dialog-text">
      <img v-if="type==0" src="../assets/img/register/jinggao.png" alt width="26px" height="26px">
      <span v-if="type==0">在线简历尚未完善，是否立即填写</span>
      <span v-if="type == 1">您的在线简历还未完善，暂时无法自荐职位,请立即完善在线简历</span>
      <span v-if="type == 2">您的简历投递成功，了解更多该职位详情，请与职位专属顾问联系</span>
      <span v-if="type == 3">您的执业信息异常，暂时无法自荐职位，请及时修正执业信息</span>
      <span v-if="type == 4">您的执业信息待审核，暂时无法自荐职位，我们会在1个工作日内完成审核，请及时登录查看审核情况</span>
    </div>
    <div class="login-dialog-button">
      <el-button class="grey-button" v-if="type == 0" @click="toIndex">暂不填写</el-button>
      <el-button class="orange-button" v-if="type==0 ||type==1" @click="toResume">立即完善</el-button>
      <el-button class="ghost-button" @click="closeDialog" v-if="type != 0 && type!= 1">我知道了</el-button>
      <el-button class="orange-button" @click="toCommunication" v-if="type != 0 && type!= 1">联系顾问</el-button>
    </div>
  </div>
</template>

<script>
import _g from '../assets/utils/global'

export default {
  props: ['type', 'platformUserId', 'jobName', 'companyName', 'jrrId', 'jobId'],
  data() {
    return {
      //type从父组件传过来的值0 登录时简历为完善 1自荐时简历未完善 2简历投递中 3执业信息异常 4执业信息待审核
    }
  },
  methods: {
    toResume() {
      //跳转到简历页面
      this.closeDialog()
      this.$router.push({ path: '/resume' })
    },
    toCommunication() {
      this.closeDialog()
      _g.apiPost('/talent/clickCommnicationButton.do', {
        state: 3,
        platformId: this.platformUserId,
        companyName: this.companyName,
        jobName: this.jobName,
        relationshipId: this.jrrId,
        jobId: this.jobId
      }).then(res => {
        if (res && res.status === 0) {
          console.log('start communicate consultant success', res)
          //跳转到沟通页面
          this.$router.push({
            path: '/communication',
            query: {
              commId: res.data,
              companyName: this.companyName
            }
          })
        }
      })
    },
    closeDialog() {
      this.$emit('input', false)
    },
    toIndex() {
      this.$emit('input', false)
    }
  },
  components: {}
}
</script>

<style lang="scss" scoped>
.login-dialog {
  padding: 10px 30px;
  box-sizing: border-box;

  .login-dialog-text {
    margin: 0 0 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-family: MicrosoftYaHei;
    font-weight: 400;
    color: #666666;
    line-height: 30px;

    img {
      margin: 0 8px 0 0;
    }
  }

  .login-dialog-button {
    display: flex;
    justify-content: space-around;
  }
}
</style>
